package test.test1210;

import java.util.ArrayList;
import java.util.Random;
import java.util.Scanner;

public class Rains {
    public static void main(String[] args) {
        Random r=new Random();
        Students stu=new Students();
        ArrayList<Students> Array =new ArrayList<> ();
        Students stu1 = Name();
        Students stu2 = Name();
        Students stu3 = Name();
        Students stu4 = Name();
        Students stu5 = Name();
        Array.add(stu1);
        Array.add(stu2);
        Array.add(stu3);
        Array.add(stu4);
        Array.add(stu5);
        int num=r.nextInt(Array.size());
        System.out.println(Array.get(num).getName());
    }

    private static Students Name() {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入学生名字：");
        String name=sc.nextLine();
        return new Students(name);
    }
}
